<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="../css/layui.css" rel="stylesheet">
<script type="text/javascript" src="../layui.all.js"></script>
		<title>...</title>
	
	</head>
	<body>
	<body class="childrenBody">
<form class="layui-form changedataBaseName">
    <input type="hidden" name="id"  id="id" value="${model.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">数据库地址</label>
        <div class="layui-input-block">
            <input type="text" name="dataBaseUrl" value="${model.dataBaseUrl }" id="dataBaseUrl"  lay-verify="required|dataBaseUrl" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">数据库名</label>
        <div class="layui-input-block">
            <input type="text" name="dataBaseName" value="${model.dataBaseName }"   id="dataBaseName" lay-verify="required|dataBaseName" class="layui-input ">
        </div>
    </div>
    
    <div class="layui-form-item">
        <label class="layui-form-label">表名</label>
        <div class="layui-input-block">
            <input type="text" name="tableName" value="${model.tableName }" id="tableName"  lay-verify="required|tableName" class="layui-input ">
        </div>
    </div>
    
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <input type="text" name="remark" value="${model.remark }" id="remark"  class="layui-input ">
        </div>
    </div>
    
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="*">保存</button>
            <button type="button" class="layui-btn layui-btn-primary" onclick="parent.close();">关闭</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="../js/common/jquery.min.js"></script>
<script>
    $(function(){
       
    })

    layui.use(['form','layer' ], function() {
        var form = layui.form;
        var layer = layui.layer;
        // 添加验证规则
        /* form.verify({
            name : function(value, item) {
                value = value.trim();
                if (value.length < 0) {
                    return "请输入教师名称";
                }
            }
        }); */

        form.on('submit(*)', function(data) {
            var index = layer.msg('提交中，请稍候',{icon: 16,time:false,shade:0.8});
            var d = data.field;
            var url = "/web_seach/accDataTable/save";
            $.ajax({
                url: url,
                data:d,
                dataType:"text",
                success: function(data){
                    layer.close(index);
                    if(data == 0){
                        layer.msg("保存成功！");
                        parent.queryTea();
                        parent.close();
                    }else{
                        layer.msg("保存失败！");
                    }
                },error:function(){
                    layer.close(index);
                    layer.msg("保存失败！");
                }
            });
            return false;
        });
    });

</script>
</body>

</body>


</html>
